package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DatabaseFieldMapper;
import com.ruoyi.system.domain.DatabaseField;
import com.ruoyi.system.service.IDatabaseFieldService;
import com.ruoyi.common.core.text.Convert;

/**
 * 字段Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-13
 */
@Service
public class DatabaseFieldServiceImpl implements IDatabaseFieldService 
{
    @Autowired
    private DatabaseFieldMapper databaseFieldMapper;

    /**
     * 查询字段
     * 
     * @param fieldId 字段主键
     * @return 字段
     */
    @Override
    public DatabaseField selectDatabaseFieldByFieldId(Long fieldId)
    {
        return databaseFieldMapper.selectDatabaseFieldByFieldId(fieldId);
    }

    /**
     * 查询字段列表
     * 
     * @param databaseField 字段
     * @return 字段
     */
    @Override
    public List<DatabaseField> selectDatabaseFieldList(DatabaseField databaseField)
    {
        return databaseFieldMapper.selectDatabaseFieldList(databaseField);
    }

    /**
     * 新增字段
     * 
     * @param databaseField 字段
     * @return 结果
     */
    @Override
    public int insertDatabaseField(DatabaseField databaseField)
    {
        return databaseFieldMapper.insertDatabaseField(databaseField);
    }

    /**
     * 修改字段
     * 
     * @param databaseField 字段
     * @return 结果
     */
    @Override
    public int updateDatabaseField(DatabaseField databaseField)
    {
        return databaseFieldMapper.updateDatabaseField(databaseField);
    }

    /**
     * 批量删除字段
     * 
     * @param fieldIds 需要删除的字段主键
     * @return 结果
     */
    @Override
    public int deleteDatabaseFieldByFieldIds(String fieldIds)
    {
        return databaseFieldMapper.deleteDatabaseFieldByFieldIds(Convert.toStrArray(fieldIds));
    }

    /**
     * 删除字段信息
     * 
     * @param fieldId 字段主键
     * @return 结果
     */
    @Override
    public int deleteDatabaseFieldByFieldId(Long fieldId)
    {
        return databaseFieldMapper.deleteDatabaseFieldByFieldId(fieldId);
    }

    /**
     * 删除字段信息
     *
     * @param tableId 数据库表id
     * @return 结果
     */
    @Override
    public int deleteDatabaseFieldByTableId(Long tableId){
        return databaseFieldMapper.deleteDatabaseFieldByTableId(tableId);
    }
}
